using BootstrapBlazor.Components;
using JinShun.OA.UI.Apis;
using JinShun.OA.UI.Auth;
using JinShun.OA.UI.Dtos;
using JinShun.OA.UI.Urls;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components;
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel.DataAnnotations;
using System.Xml.Linq;

namespace JinShun.OA.UI.Components.Pages
{
    public partial class Profiles
    {
        [NotNull]
        private ProfilesInfo? CurrentUser { get; set; }

        private async Task OnSaveDisplayName(EditContext context)
        {
            //var ret = UserService.SaveDisplayName(CurrentUser.UserName, CurrentUser.DisplayName);
            //await ShowToast(ret, "显示名称");
            //if (ret)
            //{
            //    AppContext.DisplayName = CurrentUser.DisplayName;
            //    await RenderLayout("displayName");
            //}
        }
    }

    public class ProfilesInfo
    {
        [Display(Name = "主键名称")]
        public Guid Id { get; set; }
        [Display(Name = "创建时间")]
        public DateTime CreationTime { get; set; } = DateTime.Now;
        [Display(Name = "邮箱地址")]
        public string? Email { get; set; }
        [Display(Name = "用户头像")]
        public string? Icon { get; set; }
        [Display(Name = "密码")]
        public string Password { get; set; } = string.Empty;
        [Display(Name = "加密密码")]
        public string Salt { get; set; } = string.Empty;
        [Display(Name = "登录帐号")]
        public string UserName { get; set; } = string.Empty;
        [Display(Name = "地址")]
        public string? Address { get; set; }
        [Display(Name = "显示名称")]
        public string? Name { get; set; }
        [Display(Name = "电话号码")]
        public long? Phone { get; set; }
    }
}